<?php
// $Id$
class ConfigureAction extends CommonAction
{
 public function cache(){
             $config = M("Configure");
            $list = $config->getField('var_name,value');
            // 所有配置参数统一为大写
            $tmp = array();
            foreach($list as $key=>$value){
                if(0 === strpos($value,'array(')){
                    $str = '$tmp[$key]='.$value.';';
                    eval($str);
                }else{
                    $tmp[$key] = $value;
                }
            }
            $content =   "<?php\nreturn ".var_export(array_change_key_case($tmp,CASE_UPPER),true).";\n?>";
            if(!file_put_contents(DATA_PATH.'~config.php',$content)){
                $this->error('配置缓存失败！');
    }
    $this->success('缓存成功!');
 }
}
